import java.awt.*;

public class Background{
    Image image;

    int x;
    int y;
    int width;
    int height;
    int step;

    int startx;

    int starty;
    public Background(int width, int height, int startx, int starty, int step) {
        this.width = width;
        this.height = height;
        this.startx = startx;
        this.starty = starty;
        this.step = step;
    }

    void move(int x, int y)
    {
        if (this.startx + x > 0 || this.startx + x < GameFrame.backgroundBufferedImage.getWidth())
            this.startx += x;

        if (this.starty + y > 0 || this.starty + y < GameFrame.backgroundBufferedImage.getHeight())
            this.starty += y;

        if (this.startx > GameFrame.backgroundBufferedImage.getWidth()- GameFrame.windowWidth)
            this.startx = GameFrame.backgroundBufferedImage.getWidth()- GameFrame.windowWidth;

        if (this.startx < 0)
            this.startx = 0;

        if (this.starty > GameFrame.backgroundBufferedImage.getHeight() - GameFrame.windowHeight)
            this.starty = GameFrame.backgroundBufferedImage.getHeight() - GameFrame.windowHeight;

        if (this.starty < 0)
            this.starty = 0;
    }
}